import 'package:flutter/material.dart';
import "package:get/get.dart";

//   Navigator.pop(context)
class Notice extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Color(0xffffffff),
        centerTitle: true,
        leadingWidth: 40,
        leading: IconButton(
          onPressed: () {
            Get.back();
            print('object');
          },
          icon: Image.asset('static/images/back.png'),
        ),
        title: GestureDetector(
          onTap: () => {
            showGeneralDialog(
              context: context,
              barrierColor: Colors.black54, // 半透明背景
              transitionBuilder: (ctx, anim, _, child) => Align(
                alignment: Alignment.topCenter, // 顶部对齐
                child: SlideTransition(
                  position:
                      Tween<Offset>(begin: Offset(0, -1), end: Offset.zero)
                          .animate(anim),
                  child: child,
                ),
              ),
              pageBuilder: (_, __, ___) => Material(
                color: Colors.transparent,
                child: Container(
                  height: 300,
                    margin: EdgeInsets.symmetric(horizontal: 0),
                    padding: EdgeInsets.all(10),
                    decoration: BoxDecoration(
                      color: Colors.white,
                    ),
                    child: Column(
                      children: [
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            IconButton(
                              onPressed: () {
                                Get.back();
                                print('object');
                              },
                              icon: Image.asset(
                                'static/images/back.png',
                                width: 20,
                                fit: BoxFit.fitWidth,
                              ),
                            ),
                            Row(
                              children: [
                                Text('新增关注'),
                                SizedBox(
                                  width: 5,
                                ),
                                Image.asset(
                                  'static/shang.png',
                                  width: 10,
                                  fit: BoxFit.fitWidth,
                                )
                              ],
                            ),
                            SizedBox(
                              width: 35,
                            )
                          ],
                        ),
                        Divider(color: Color(0XFFDDDDDD),),
                        SizedBox(height: 10,),
                        Text('全部消息'),
                        SizedBox(height: 15,),
                        Text('新增关注'),
                        SizedBox(height: 15,),
                        Text('评论'),
                        SizedBox(height: 15,),
                        Text('点赞'),
                      ],
                    )),

              ),
            )
          },
          child: Text('新增关注'),
        ),
      ),
      body: ListView(
        children: [
          for(var item in [])
          fans(),
        ],
      ),
    );
  }
}
 
Widget fans() {
  return Container(
    margin: EdgeInsets.only(left: 15, right: 15, top: 30),
    child: Row(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        CircleAvatar(
          radius: 22,
          backgroundImage: AssetImage('static/aaa.png'), // 替换为你的静态图片路径
        ),
        SizedBox(width: 10), // 添加间距
        Expanded(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                '啊呜严选啊呜严选',
                style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
              ),
              SizedBox(height: 2), // 添加间距
              Text(
                '关注了你 07-25',
                style: TextStyle(
                  color: Colors.grey,
                  fontSize: 12,
                ),
              ),
              Text(
                '昨天 12:22',
                style: TextStyle(
                  color: Colors.grey,
                  fontSize: 12,
                ),
              ),
            ],
          ),
        ),
        SizedBox(width: 10), // 添加间距
        GestureDetector(
          onTap: () {
            // 处理互关逻辑
            print('互关按钮被点击');
          },
          child: Container(
            margin: EdgeInsets.only(top: 10),
            padding: EdgeInsets.symmetric(horizontal: 15, vertical: 5),
            decoration: BoxDecoration(
              color: Colors.grey[200],
              borderRadius: BorderRadius.circular(20),
            ),
            child: Text(
              '互关',
              style: TextStyle(
                color: Colors.black,
                fontSize: 16,
              ),
            ),
          ),
        ),
      ],
    ),
  );
}
